<template>
  <van-nav-bar
      fixed
      title="商品列表"
      left-text="返回"
      left-arrow
      @click-left="onClickLeft"
  />
  <van-divider></van-divider>
  <van-divider></van-divider>
  <div v-for="item in list" :key="item">
    <van-card
        num="1"
        :price="item.price"
        :title="item.name"
        :thumb="'http://local.bs.com/storage/'+item.image"
        origin-price="10.00"
    >
    </van-card>
  </div>
  <van-pagination v-model="currentPage" :total-items="total" :items-per-page="15" @change="pageClick"/>
  <van-divider></van-divider>
</template>

<script>
import {getGoodsList} from "@/api/goods";

export default {
  name: "Goods",
  data(){
    return {
      list:{},
      currentPage:1,
      total:0,
    }
  },
  created() {
    getGoodsList(1).then((res)=>{
      this.list = res.data.data
      this.total = res.data.total
    })
  },
  methods:{
    onClickLeft() {
      history.back()
    },
  }
}
</script>

<style scoped>

</style>
